package com.scitc.pleasurevideo.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;

public class DialogUtils {
    public static void showConfirmNormalDia(String title, String subTitle,
                                            String okText, String canceText, Context context,
                                            final View.OnClickListener clickListener) {
        showConfirmNormalDia(title, subTitle, okText, canceText, context,
                clickListener, null);
    }

    public static void showMustConfirmNormalDia(String title, String subTitle,
                                                String okText, Context context,
                                                final View.OnClickListener clickListener) {
        showMustUpdateNormalDia(title, subTitle, okText, context,
                clickListener, null);
    }

    public static void showConfirmNormalDia(String title, String subTitle,
                                            String okText, String canceText, Context context,
                                            final View.OnClickListener clickListener,
                                            final View.OnClickListener cancelClickListener) {

        AlertDialog.Builder normalDia = new AlertDialog.Builder(context);

        normalDia.setTitle(title);
        String message = subTitle;
        normalDia.setMessage(message);

        normalDia.setPositiveButton(okText,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (clickListener != null) {
                            clickListener.onClick(null);
                        }
                    }
                });
        normalDia.setNegativeButton(canceText,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (cancelClickListener != null) {
                            cancelClickListener.onClick(null);
                        }
                    }
                });
        try {
            normalDia.create().show();
        } catch (Exception e) {
        }


    }

    public static void showMustUpdateNormalDia(String title, String subTitle,
                                               String okText, Context context,
                                               final View.OnClickListener clickListener,
                                               final View.OnClickListener cancelClickListener) {

        AlertDialog.Builder normalDia = new AlertDialog.Builder(context);

        normalDia.setTitle(title);
        String message = subTitle;
        normalDia.setMessage(message);
        normalDia.setCancelable(false);

        normalDia.setPositiveButton(okText,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (clickListener != null) {
                            clickListener.onClick(null);
                        }
                    }
                });


        normalDia.create().show();

    }
}
